{% extends "base.html" %}

{% block title %}用户信息{% endblock %}

{% block content %}
<div class="container mt-4">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h4 class="mb-0">用户信息</h4>
                </div>
                <div class="card-body">
                    {% if error %}
                        <div class="alert alert-danger" role="alert">
                            {{ error }}
                        </div>
                        <a href="{{ url_for('web.my_profile') }}" class="btn btn-primary">重新输入</a>
                    {% elif user %}
                        <div class="row mb-3">
                            <div class="col-sm-3 font-weight-bold">用户ID:</div>
                            <div class="col-sm-9">{{ user.id }}</div>
                        </div>
                        <div class="row mb-3">
                            <div class="col-sm-3 font-weight-bold">用户名:</div>
                            <div class="col-sm-9">{{ user.username }}</div>
                        </div>
                        <div class="row mb-3">
                            <div class="col-sm-3 font-weight-bold">邮箱:</div>
                            <div class="col-sm-9">{{ user.email or '未设置' }}</div>
                        </div>
                        <div class="row mb-3">
                            <div class="col-sm-3 font-weight-bold">昵称:</div>
                            <div class="col-sm-9">{{ user.nickname or '未设置' }}</div>
                        </div>
                        <div class="row mb-3">
                            <div class="col-sm-3 font-weight-bold">状态:</div>
                            <div class="col-sm-9">
                                {% if user.status == 1 %}
                                    <span class="badge bg-success">正常</span>
                                {% else %}
                                    <span class="badge bg-secondary">禁用</span>
                                {% endif %}
                            </div>
                        </div>
                        <div class="row mb-3">
                            <div class="col-sm-3 font-weight-bold">创建时间:</div>
                            <div class="col-sm-9">{{ user.created_at }}</div>
                        </div>
                        <div class="row mb-3">
                            <div class="col-sm-3 font-weight-bold">更新时间:</div>
                            <div class="col-sm-9">{{ user.updated_at }}</div>
                        </div>
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}